/*
 * Label.java
 * Created on July 25, 2007, 9:56 AM
 */

package view;

import javax.microedition.lcdui.Graphics;

/**
 *
 * @author erol
 */
public class Label extends Component {
    
    private String label;
        
    private Color lineColor;
    
        
    public Label() {
        super();        
    }

    public Label(int width, int height){
        super(width, height);
    }
    
    public Label(int x, int y, int width, int height){
        super(x, y, width, height);
    }
    
    /**
     *  evaluated at the end of super()
     */
    protected void init() {
        label = "";
        lineColor = getFgColor();
    }    

    public void paint(Graphics g) {                                                               
        
        // paint label text
        GuiUtils.setColor(g, getFgColor());
        g.drawString(label, get_x_content(), get_y_content(), Graphics.TOP|Graphics.LEFT);
    }

    protected void doFire() {
        
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
        paintFlag = true;
    }

    protected void setHighLevelProperty(int property, String value) {
        
        if(Fields.LABEL == property){
            
            label = value;
            
        } else if(Fields.LINE_COLOR == property){
            
            lineColor = GuiUtils.getColor(value);
        }
    }
    
    //-------------------------------------------------------------------    
        
}
